;;; init-translate.el --- configuration for sdcv -*- lexical-binding: t -*-
;;; Commentary:
;;; Code:

(autoload 'sdcv-search-input "sdcv" "Search input word and display with buffer." t)
(autoload 'sdcv-search-input+ "sdcv" "Search input word and display with tooltip." t)
(autoload 'sdcv-search-pointer "sdcv" "Search around word and display with buffer." t)
(autoload 'sdcv-search-pointer+ "sdcv" "Search around word and display with tooltip." t)

(with-eval-after-load 'sdcv
  (setq sdcv-dictionary-data-dir (expand-file-name "~/sys/sdcv-dict/"))
  (setq sdcv-say-word-p t)
  (setq sdcv-dictionary-simple-list
        '("懒虫简明英汉词典"
          "懒虫简明汉英词典"
          "KDic11万英汉词典"))
  (setq sdcv-dictionary-complete-list
        '("懒虫简明英汉词典"
          "英汉汉英专业词典"
          "XDICT英汉辞典"
          "stardict1.3英汉辞典"
          "WordNet"
          "XDICT汉英辞典"
          "Jargon"
          "懒虫简明汉英词典"
          "FOLDOC"
          "新世纪英汉科技大词典"
          "KDic11万英汉词典"
          "朗道汉英字典5.0"
          "CDICT5英汉辞典"
          "新世纪汉英科技大词典"
          "牛津英汉双解美化版"
          "21世纪双语科技词典"
          "quick_eng-zh_CN")))




(defvar ctrlwei-translate-map (make-sparse-keymap)
  "Keybinding for translate.")

(global-set-key (kbd "C-z") ctrlwei-translate-map)
(define-key ctrlwei-translate-map (kbd "r") #'sdcv-search-pointer+)
(define-key ctrlwei-translate-map (kbd "e") #'sdcv-search-pointer)
(define-key ctrlwei-translate-map (kbd "w") #'sdcv-search-input+)
(define-key ctrlwei-translate-map (kbd "q") #'sdcv-search-input)


(global-set-key (kbd "M-q i") (lambda ()
                                (interactive)
                                (if (and (featurep 'lsp-bridge) lsp-bridge-mode)
                                    (lsp-bridge-toggle-sdcv-helper)
                                  (toggle-corfu-english-helper))))

(provide 'init-translate)
;;; init-sdcv.el ends here
